package chixing.day15;

public class MathDemo {
    public static void main(String[] args) {
        int min=Math.min(10, 20);
        int max=Math.max(10, 20);
        int abs=Math.abs(-10);//绝对值
        long round=Math.round(10.5);//四舍五入
        System.out.println(round);
        //最小的整数>=10.5
        double ceil = Math.ceil(10.5);
        System.out.println(ceil);
        //最大的整数<=10.5
        double floor = Math.floor(10.5);
        System.out.println(floor);
        //return a navigable double value,[0.0-1)
        for(int i =0;i<60;i++){
            int ran2 = (int) (Math.random() * 51);
            System.out.print(ran2 + ", ");
        }

        // 160 - 270 之间的任意一个随机整数int
        //Math.random()  [0.0 ~ 1)
        System.out.println();
        System.out.println("----------160 - 270 之间的任意一个随机整数int-------");
        for(int i =0;i<100;i++){
            int ran3 =(int) ( Math.random() * (270-160 +1) + 160);
            System.out.print(ran3 + ", ");
        }
    }
}
